<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" errorPage="500.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page import="java.util.List"%>
<%@ page import="com.film.service.ReviewService"%>
<%@ page import="com.film.service.impl.ReviewServiceImpl"%>
<%@ page import="com.film.domain.*"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="../admin_css/review.css">
    <link rel="stylesheet" href="../admin_css/iconfont/iconfont.css">
    <script src="../admin_js/jquery-1.12.4.js"></script>
</head>
<body>
	<% ReviewService service = new ReviewServiceImpl();
		List<Review>list= service.selectReview();
		request.setAttribute("list",list);
	%>
<div class="content">
    <div class="container" style="padding: 0px;width: 100%;">
    <div class="tou"><span class="iconfont icon-pinglun"></span><span style="font-weight: bold; margin-left: 6px;">评论信息管理</span></div>
    <table class="table">
        <caption><span id="sum" style="margin-left: 30px;">共${adminreviewsSize}条</span></caption>
        <thead>
        <tr>
            <th>编号</th>
            <th>电影名称</th>
            <th>用户</th>
            <th>时间</th>
            <th>评论内容</th>
            <th>分数</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody id="table">
        <c:if test="${adminreviews!=null}">
		   	<c:forEach items="${adminreviews}" var="o">
            <tr>
                <td id="filmId1">${o.revId}</td>
                <td id="filmName1">${o.film.getFilmName()}</td>
                <td id="filmCategory1">${o.user.getuName()}</td>
                <td id="director1">${o.revTime}</td>
                <td id="screenwriters1" title="${o.revContent}">${o.revContent}</td>
                <td id="filmTime1">${o.revScore}</td>
                <td>
                    <a href="${pageContext.request.contextPath}/ReviewController?id=${o.revId}"><button id="but6" type="button" class="btn btn-default" style="border:1px solid red;"><span>删除</span></button></a>
                </td>
            </tr>
        	 </c:forEach>
   		 </c:if>
        </tbody>
    </table>
    <!--分页-->
    <div id="fenye" class="panel-footer" style="text-align: center; display: block;">
        <nav style="height: 35px;">
            <ul class="pagination" style="margin-top:0px;">
                <li id="Previous" class="disabled"  style="cursor: pointer;">
                    <a aria-label="Previous">
                        <span aria-hidden="true">«</span>
                    </a>
                </li>

               <c:forEach items="${adminreview}" begin="0" end="${adminreviewSize<=7?0:(adminreviewSize/7)}" varStatus="temp">               
               		<li flag="${temp.count}" class="${param.flag==temp.count?'active':''} data"><a href="${pageContext.request.contextPath}/ReviewTypePage.do?page=${temp.count}">${temp.count}</a></li>
               </c:forEach>
              <li id="li" style="cursor: pointer;">
                    <a aria-label="Next">
                        <span aria-hidden="true">»</span>
                    </a>
                </li>
            </ul>
        </nav>
        <div class="clearfix"></div>
    </div>
    <!--添加弹出框 -->
    <div class="modal fade" id="add" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title" id="myModalLabel" style="text-align: center;">电影信息添加</h4>
                </div>
                <div class="text-center" style="margin-top: 15px; text-align: center;">
                    <div class="form-group">
                        <label for="firstname" class="col-sm-3 control-label">电影名称</label>
                        <div class="">
                            <input type="text" class="form-control" style="margin-left: 0px; display: inherit;width: 230px;">
                        </div>
                    </div>
                     <div class="form-group">
                        <label for="firstname" class="col-sm-3 control-label">电影英文名</label>
                        <div class="">
                            <input type="text" class="form-control" style="margin-left: 0px; display: inherit;width: 230px;">
                        </div>
                    </div>
                     <div class="form-group">
                        <label for="firstname" class="col-sm-3 control-label">电影产地</label>
                        <div class="">
                            <input type="text" class="form-control" style="margin-left: 0px; display: inherit;width: 230px;">
                        </div>
                    </div>
                     <div class="form-group">
                        <label for="firstname" class="col-sm-3 control-label">电影语言</label>
                        <div class="">
                            <input type="text" class="form-control" style="margin-left: 0px; display: inherit;width: 230px;">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="firstname" class="col-sm-3 control-label">电影图片</label>
                        <div class="">
                            <input type="file" style="margin-left: 0px; display: inherit;width: 230px;" id="posterUrl2">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="firstname" class="col-sm-3 control-label">电影类型</label>
                        <div class="">
                            <select id="select" class="form-control" style="margin-left: 0px; display: inherit;width: 230px;" name="">
                                
                                    <option value="1">动作</option>
                                
                                    <option value="2">爱情</option>
                                
                                    <option value="3">谍战</option>
                                
                                    <option value="7">悬疑</option>
                                
                                    <option value="8">侦探</option>
                                
                                    <option value="9">科幻</option>
                                
                                    <option value="10">战争</option>
                                
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="firstname" class="col-sm-3 control-label">电影导演</label>
                        <div class="">
                            <input type="text" class="form-control" style="margin-left: 0px; display: inherit;width: 230px;" id="director2">
                        </div>
                    </div>
                  
                    <div class="form-group">
                        <label for="firstname" class="col-sm-3 control-label">电影演员</label>
                        <div class="">
                            <input type="text" class="form-control" style="margin-left: 0px; display: inherit;width: 230px;" id="star2">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="firstname" class="col-sm-3 control-label">电影首映时间</label>
                        <div class="">
                            <input type="text" class="form-control" style="margin-left: 0px; display: inherit;width: 230px;">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="firstname" class="col-sm-3 control-label">片长</label>
                        <div class="">
                            <input type="text" class="form-control" style="margin-left: 0px; display: inherit;width: 230px;">
                        </div>
                    </div>
                     <div class="form-group">
                        <label for="firstname" class="col-sm-3 control-label">电影描述</label>
                        <div class="">
                            <input type="text" class="form-control" style="margin-left: 0px; display: inherit;width: 230px;">
                        </div>
                    </div>
                </div>
                <div class="modal-footer" style="text-align: center;">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button id="but4" type="button" class="btn btn-danger" data-dismiss="modal">添加</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
</div>
</div>
</body>
<script>
    $("#Previous").click(function() {
        var firstPage=$("。pagination>li.active").prev().find("a").eq(0).html();
        var first=$(".pagination.data:first a").html();
        var activepage=$(".pagination.active a").html();
        if(first==activepage){
            alert("已经是第一页了");
        }else{
        	 window.location.href="/film/ReviewTypePage.do?page="+firstPage;
        }
    });

    $("#li").click(function(){
        var lastPage=$(".pagination>li.active").next().find("a").eq(0).html();
        var first=$(".pagination.data:last a").html();
        var activepage=$(".pagination.active a").html();
        if(first==activepage){
            alert("已经是最后一页了");
        }else{
        	window.location.href="/film/ReviewTypePage.do?page="+lastPage;
        }
    });
</script>
</html>
    